import {ApiProperty} from "@nestjs/swagger";
import {IsNotEmpty, IsString, MaxLength, MinLength,} from "class-validator";
import {User} from "@/modules/user/entities/user.entity";

export class CreateUserDto extends User {
    @ApiProperty({
        description: '用户名',
        example: '张三',
        required: true
    })
    @IsNotEmpty({message: '用户名不能为空'})
    @IsString({message: '用户名必须是 String 类型'})
    @MinLength(5, {message: '账号至少5个字符'})
    @MaxLength(20, {message: '账号最多20个字符'})
    username: string

    @ApiProperty({
        description: '密码',
        example: '123',
        required: true
    })
    @IsString({message: 'password 类型错误，正确类型 string'})
    @IsNotEmpty({message: 'password 不能为空'})
    password: string
}
